import Vue from 'vue'

import HomePage from '@/views/HomePage'
import News from '@/views/News'
import Sports from '@/views/Sports'

// 二级路由引入
import SportsHomePage from '@/views/second/SportsHomePage'
import DomesticSports from '@/views/second/DomesticSports'
import ForeignSports from '@/views/second/ForeignSports'

// 1.引入
import VueRouter from 'vue-router'
// 2.让vue使用VueRouter这个插件
Vue.use(VueRouter)
// 3.创建vue实例
const router = new VueRouter({
  // router是一个数组，数组里面的每一个对象都是一条路由规则
  routes: [
     // 网页打开默认显示 - 主页页部分 重定向到/HomePage
    {
      path: '/',
      redirect: '/HomePage',
    },
    {
      //路径  组件
      path: '/homepage',
      component: HomePage,
    },
    {
      path: '/news',
      component: News,
    },
    {
      path: '/sports',
      component: Sports,
      children: [
        {
          path:'sportshomepage',
          component:SportsHomePage
        },
        {
          path:'domesticsports',
          component:DomesticSports
        },
        {
          path:'foreignsports',
          component:ForeignSports
        }
      ]
    },
  ],
})
export default router
